<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    (function(){
        var x = y = 1;
    })();
    var z;

    console.log(y); //? 1 y没有使用var声明 为全局
    console.log(z); //? undefined 没赋值
    console.log(x); //? Uncaught ReferenceError: x is not defined x由var声明，提升到当前作用域顶部 当前作用域是函数
</script>
</body>
</html>
